//
// Created by entaoyang@163.com on 2017/10/21.
// Copyright (c) 2017 yet.net. All rights reserved.
//

import Foundation


//pair, NOT allow nil
infix operator =>: ComparisonPrecedence
infix operator >>>: ComparisonPrecedence

public class KeyValue: CustomStringConvertible {
    public var key: String = ""
    public var value: Any

    public init(_ k: String, _ v: Any) {
        self.key = k
        self.value = v
    }

    public var strValue: String {
        "\(value)"
    }
    public var intValue: Int {
        value as! Int
    }
    public var longValue: Long {
        value as! Long
    }
    public var doubleValue: Double {
        value as! Double
    }
    public var floatValue: Float {
        value as! Float
    }
    public var boolValue: Bool {
        value as! Bool
    }

    public var description: String {
        key + " = \(value)"
    }
}


public func =>(k: String, v: Any) -> KeyValue {
    KeyValue(k, v)
}

public func >>>(k: String, v: Any) -> KeyValue {
    KeyValue(k, v)
}


